import request from '@/router/axios'
import moment from 'moment';
import {
  getLineName,
  getStationName
} from "../../../subwayRat/commonCheck";
export function getShouJieSuanRepairSubmit(query) {
  return request({
    url: '/check/xw_js_tvm/getShouJieSuanRepairSubmit',
    method: 'post',
    params: query
  })
}
export function getPeriods(query) {
  return request({
    url: '/check/xw_js_tvm/getPeriods',
    method: 'post',
    params: query
  })
}
/**
 * 提交TVM结算SW_ST_TVM_INCOME_SETTLE
 * @param query
 */
export function repairSubmitXwTvmData(query) {
  return request({
    url: '/check/xw_js_tvm/repairSubmitXwTvmData',
    method: 'post',
    //params: query
    data: query
  })
}

//查看是否有待确认数据
export function getTvmNotConfirmDatas(query) {
  return request({
    url: '/check/xw_js_tvm/getTvmNotConfirmDatas',
    method: 'post',
    params: query,
    data: query
  })
}

export function waitSubmitMainOptionList(th) {
  return {
    emptyBtn: false,
    editBtn: false,
    rowKey: 'index',
    delBtn: false,
    addBtn: false,
    refreshBtn: false,
    columnBtn: false,
    border: true,
    index: true,
    indexLabel: '序号',
    page: false,
    align: 'center',
    menuWidth: 150,
    height: 480,
    menuAlign: 'center',
    selection: true,
    reserveSelection: false,
    column: [
    // {
    //   label: "编号", prop: "id", hide: true
    // },
    {
      label: "线路", prop: "lineCode", search: false, hide:true, searchslot: true, formatter: function (row, value, label, column) {
        return getLineName(value);
      }
    },
    {
      label: "站点",
      prop: "stationCode",
      search: true,
      searchslot: true,
      formatter: function (row, value, label, column) {
        return getStationName(row.lineCode, value);
      }
    },
    {
      hide: false,
      label: 'TVM编号',
      prop: 'tvmCode',
      type: 'select',
      search: true,
      filterable: true,
      searchslot: true,
      dicFlag: false,
    },
    { prop: "preSubmitDate", label: "上次结算日期", type: 'date', valueFormat: 'yyyy-MM-dd' },
    { prop: "revenueTime", label: "收入日期", type: 'date', search: true, valueFormat: 'yyyy-MM-dd' },
    {
      prop: "lastSubmitTime", label: "最晚提交日期", formatter: function (row, v) {
        if (row.settlementTerm >= 0) {
          return moment(row.check_submit_end_date).subtract(1, "days").format('YYYY-MM-DD');
        } else {
          return row.revenueTime;
        }
      }
    },
    {
      prop: "cashReceiptAmount", hide: true, label: "现金实收金额", formatter: function (row, v) {
        if (v) {
          return Number(v).toFixed(2);
        }
        return v;
      }
    },
    {
      prop: "checkAmount", label: "卸载清点金额", formatter: function (row, v) {
        if (v) {
          return Number(v).toFixed(2);
        }
        return v;
      }
    },
    {
      prop: "dailyCashTotalAmount", hide: true, label: "结账单据现金收入金额", formatter: function (row, v) {
        if (v) {
          return Number(v).toFixed(2);
        }
        return v;
      }
    },
    {
      prop: "billCashCashReceiptAmount", hide: true, label: "结账单据现金接收总计", formatter: function (row, v) {
        if (v) {
          return Number(v).toFixed(2);
        }
        return v;
      }
    },
    {
      prop: "billCashCashChangeAmount", hide: true, label: "结账单据现金找零总计", formatter: function (row, v) {
        if (v) {
          return Number(v).toFixed(2);
        }
        return v;
      }
    },
    {
      prop: "electronicPayTotalAmount", hide: true, label: "结账单据电子收入金额", formatter: function (row, v) {
        if (v) {
          return Number(v).toFixed(2);
        }
        return v;
      }
    }
    ]
  }
}
